import instance from "./axios";

import baseSevice  from "../api/base.js";

import login from "../api/login";
import user from "../api/user";
import home from "../api/home";
import menu from "../api/menu";
import right from "../api/right";
import forms from "../api/tables";
import roles from "../api/role";
import template from "../api/temp";

import attach from "../api/attach.js";

import equipment from "../api/equipment";
import equipmentAd from "../api/equipmentAd";

import mqtt from "../api/mqtt";
import config from "../api/config";
import hardware from "../api/hardware";
import product from "../api/product";
import project from "../api/project";
import dept from "../api/dept";
import uploadSync from "../api/uploadsync";

import sysprops from "../api/sysprops";

import section from "../api/section";

import clienttask from "../api/clienttask";
import syslogs from "../api/syslogs";

import serial from "../api/serial.js"

import importModule from "../api/import.js";


export const baseSeviceHeart =(data) =>instance(baseSevice.heartbeat,data);
export const baseFlushedCache =(data) =>instance(baseSevice.flushedCache,data);

/* 导入 */
export const baseTemplate = (data) => instance(importModule.download, data);
export const baseImport = (data) => instance(importModule.import, data);

export const doLogin = (data) => instance(login.login, data);

export const updatePwd = (data) => instance(login.updatePwd, data);

/* 首页 */
export const getHomeData = (data) => instance(home.getData, data);

/**
 * 附件
 * @param {*} data
 * @returns
 */
export const reqAttachList = (data) => instance(attach.list, data);

/**
 * 业务表单公用接口
 *
 */
export const reqTempConfig = (data) => instance(template.config, data);

export const reqTempList = (data) => instance(template.pages, data);

export const reqTempSave = (data) => instance(template.save, data);

export const reqTempDel = (data) => instance(template.del, data);

/**
 * 用户信息
 * 用户列表查询
 * @param {*} data
 * @returns
 */
export const reqUserList = (data) => instance(user.list, data); //列表查询
export const reqUserSave = (data) => instance(user.save, data); //新增 or 修改
export const reqUserDel = (data) => instance(user.del, data); //删除
export const reqUserListBy = (data) => instance(user.listby, data); //列表查询

/**
 * 角色信息查询
 *
 */
export const reqRoleList = (data) => instance(roles.list, data); //列表查询
export const reqRoleSave = (data) => instance(roles.save, data); //新增 or 修改
export const reqRoleDel = (data) => instance(roles.del, data); //删除
export const reqRoleRelUsers = (data) => instance(roles.relUsers, data); //关联用户

/**
 * 菜单管理
 * @param {*} data
 * @returns
 */
export const reqMenuList = (data) => instance(menu.list, data); //列表查询
export const reqMenuSave = (data) => instance(menu.save, data);
export const reqMenuDel = (data) => instance(menu.delete, data);

/**
 * 权限管理
 * @param {*} data
 * @returns
 */
export const reqRightList = (data) => instance(right.list, data); //权限
export const reqRightRoleRel = (data) => instance(right.roleRel, data);

/**
 * 表单管理  列表查询
 * @param {*} data
 * @returns
 */
export const reqFormsList = (data) => instance(forms.list, data); //列表查询
export const reqFormsSave = (data) => instance(forms.save, data); //新增 / 修改
export const reqFormsDel = (data) => instance(forms.del, data); //删除

export const reqFormsItemList = (data) => instance(forms.itemList, data); //列表查询

/**
 * 设备管理
 */

export const equipmentList = (data) => instance(equipment.list, data); //列表查询
export const equipmenetTree = (data) => instance(equipment.tree, data); //列表查询
export const getSettingPage = (data) =>
  instance(equipment.getSettingPage, data); //列表查询
export const saveSettingPage = (data) =>
  instance(equipment.saveSettingPage, data); //列表查询

export const equipmentHistoryInfo = (data) => instance(equipment.getInfo, data); //列表查询
export const equipmentLastInfo = (data) => instance(equipment.lastInfo, data); //列表查询

export const equipmentLastHeartInfo = (data) => instance(equipment.lastHeartInfo, data); //列表查询

export const downloadDay = (data) => instance(equipment.downloadDay, data); //列表查询
export const downloadFile = (data) => instance(equipment.downloadFile, data); //列表查询


/**
 *  设备通道管理
 * @param {]} data 
 * @returns 
 */
export const equipmentAdList= (data)=> instance(equipmentAd.list,data);
export const equipmentAdSaveData =(data)=> instance(equipmentAd.saveData,data); 
export const equipmentAdImpData =(data)=> instance(equipmentAd.impData,data);

//mqtt
export const getMqTable = (data) => instance(mqtt.getTable, data); //列表查询
export const saveMqTable = (data) => instance(mqtt.save, data); //列表查询
export const delMqTable = (data) => instance(mqtt.del, data); //列表查询
export const enableMq = (data) => instance(mqtt.enable, data); //列表查询
export const disableMq = (data) => instance(mqtt.disable, data); //列表查询

//config
export const getConfigParams = (data) => instance(config.getParams, data); //列表查询

// hardware
export const getHardwareInfo = (data) => instance(hardware.getInfo, data); //列表查询
export const hardwareEdit = (data) => instance(hardware.editInfo, data); //列表查询
export const hardwareDel = (data) => instance(hardware.delInfo, data); //列表查询
export const relProject = (data) => instance(hardware.relProject, data); //关联项目

// product 产品型号
export const getProductList = (data) => instance(product.getList, data);
export const getProductData = (data) => instance(product.getData, data);
export const saveProduct = (data) => instance(product.save, data);
export const delProduct = (data) => instance(product.del, data);
export const getProductById = (data) => instance(product.getById, data);

//project
export const projectList = (data) => instance(project.list, data); //列表查询
export const projectSave = (data) => instance(project.save, data); //新增 or 修改
export const projectDelete = (data) => instance(project.delete, data); //删除
export const projectTree = (data) => instance(project.tree, data); //项目树

//dept
export const deptList = (data) => instance(dept.list, data); //列表查询
export const deptSave = (data) => instance(dept.save, data); //新增 or 修改
export const deptDelete = (data) => instance(dept.delete, data); //删除

//upload_file_info_logs
export const uploadSyncLogsList = (data) => instance(uploadSync.list, data); //列表查询

export const uploadSyncBuild = (data) => instance(uploadSync.build, data); //开始生产数据
export const uploadSyncChannel = (data) => instance(uploadSync.channel, data); //获取通道数据
export const uploadSyncData = (data) => instance(uploadSync.data, data); //获取数据

export const uploadFileUnpack = (data) => instance(uploadSync.unpack, data); //解压文件

//sysprops
export const syspropsList = (data) => instance(sysprops.list, data); //列表查询
export const syspropsSave = (data) => instance(sysprops.save, data); //新增 or 修改
export const syspropsDel = (data) => instance(sysprops.del, data); //删除
export const syspropsFlushed = (data) => instance(sysprops.flushed, data); //删除

//section
export const sectionList = (data) => instance(section.list, data); //列表查询
export const sectionSave = (data) => instance(section.save, data); //新增 or 修改
export const sectionDel = (data) => instance(section.del, data); //删除

//sectionad
export const sectionadList = (data) => instance(sectionAd.list, data); //列表查询
export const sectionadSave = (data) => instance(sectionAd.save, data);
export const sectionadDel = (data) => instance(sectionAd.del, data); //删除

//clienttask
export const clienttaskList = (data) => instance(clienttask.list, data);
export const clienttaskSave = (data) => instance(clienttask.save, data);
export const clienttaskDel = (data) => instance(clienttask.del, data);
export const clienttaskAddEquipment = (data) =>
  instance(clienttask.addEquipment, data);
export const clienttaskDelEquipment = (data) =>
  instance(clienttask.delEquipment, data);

export const clienttaskMqttTopic = (data) =>
  instance(clienttask.mqtttopic, data);
export const clienttaskPublishMqtt = (data) =>
  instance(clienttask.publishMqtt, data);

export const clienttaskRemoteTask = (data) =>
  instance(clienttask.remoteTask, data);

export const clienttaskExportTask = (data) =>
  instance(clienttask.exportTask, data);


export const serialPorts = (data) => instance(serial.ports,data);
export const serialGet = (data) => instance(serial.get,data);
export const serialSave = (data) => instance(serial.save,data);

/**
 * 操作日志
 */
export const reqLogList = (data) => instance(syslogs.list, data); //列表查询